<?php
    require "sql.php";
    $filename = $_POST['filename'];
    $content = $_POST['content'];
    $isPublic = $_POST['isPublic'];
    $time = date('Y-m-d G:i:s');
    $str1 = "update file set content = '".$content."',isPublic='".$isPublic."',update_time = '".$time."' where file_name = '".$filename."' and author = '".$_COOKIE['username']."'";
    $data =array(
        array(
            'code'=>0
        ),
        array(
            'code'=>1
        )
    );
    if($conn->query($str1)===true){
        echo json_encode($data[1]);
    }else{
        echo json_encode($data[0]);
    }
    $conn->close();
?> 